--- leptonica-1.73.org/src/makefile.static
+++ leptonica-1.73/src/makefile.static
@@ -120,3 +120,3 @@
 #   Test for processor endianness (valid with gnu make only)
-ENDIANNESS := $(shell $(CC) -o endiantest endiantest.c; ./endiantest; rm -f endiantest)
+ENDIANNESS := $(shell echo __BYTE_ORDER | $(CC) -include endian.h -E - | tail -n 1 | sed -e s/1234/L_LITTLE_ENDIAN/ -e s/4321/L_BIG_ENDIAN/)
 
